<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActionController::Cookies</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActionController::Cookies</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/cookies_rb.html">
                vendor/rails/actionpack/lib/action_controller/cookies.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
<a href="Cookies.html">Cookies</a> are read and written through
ActionController#cookies.
</p>
<p>
The <a href="Cookies.html#M000983">cookies</a> being read are the ones
received along with the request, the <a
href="Cookies.html#M000983">cookies</a> being written will be sent out with
the response. Reading a cookie does not get the cookie object itself back,
just the value it holds.
</p>
<p>
Examples for writing:
</p>
<pre>
  # Sets a simple session cookie.
  cookies[:user_name] = &quot;david&quot;

  # Sets a cookie that expires in 1 hour.
  cookies[:login] = { :value =&gt; &quot;XJ-122&quot;, :expires =&gt; 1.hour.from_now }
</pre>
<p>
Examples for reading:
</p>
<pre>
  cookies[:user_name] # =&gt; &quot;david&quot;
  cookies.size        # =&gt; 2
</pre>
<p>
Example for deleting:
</p>
<pre>
  cookies.delete :user_name
</pre>
<p>
Please note that if you specify a :domain when setting a cookie, you must
also specify the domain when deleting the cookie:
</p>
<pre>
 cookies[:key] = {
   :value =&gt; 'a yummy cookie',
   :expires =&gt; 1.year.from_now,
   :domain =&gt; 'domain.com'
 }

 cookies.delete(:key, :domain =&gt; 'domain.com')
</pre>
<p>
The option symbols for setting <a href="Cookies.html#M000983">cookies</a>
are:
</p>
<ul>
<li><tt>:value</tt> - The cookie&#8216;s value or list of values (as an array).

</li>
<li><tt>:path</tt> - The path for which this cookie applies. Defaults to the
root of the application.

</li>
<li><tt>:domain</tt> - The domain for which this cookie applies.

</li>
<li><tt>:expires</tt> - The time at which this cookie expires, as a Time
object.

</li>
<li><tt>:secure</tt> - Whether this cookie is a only transmitted to HTTPS
servers. Default is <tt>false</tt>.

</li>
<li><tt>:http_only</tt> - Whether this cookie is accessible via scripting or
only HTTP. Defaults to <tt>false</tt>.

</li>
</ul>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000983">cookies</a>&nbsp;&nbsp;
      <a href="#M000982">included</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000982" class="method-detail">
        <a name="M000982"></a>

        <div class="method-heading">
          <a href="#M000982" class="method-signature">
          <span class="method-name">included</span><span class="method-args">(base)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000982-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000982-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/cookies.rb, line 47</span>
47:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
48:       <span class="ruby-identifier">base</span>.<span class="ruby-identifier">helper_method</span> <span class="ruby-identifier">:cookies</span>
49:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000983" class="method-detail">
        <a name="M000983"></a>

        <div class="method-heading">
          <a href="#M000983" class="method-signature">
          <span class="method-name">cookies</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the cookie container, which operates as described above.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000983-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000983-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/cookies.rb, line 53</span>
53:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies</span>
54:         <span class="ruby-constant">CookieJar</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
55:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>